if(window.$==undefined){
    window.$={};
}
$.rest=function (url,method,json,callback) {
    if (method != null) {
        method = method.toUpperCase();
    }
    let xmlHttp;
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    } else {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            callback(JSON.parse(xmlHttp.responseText));
        }
    };
    xmlHttp.open(method, url, true);
    if (method == "GET") {
        xmlHttp.send();
    } else {
       xmlHttp.setRequestHeader("Content-type", "application/json; charset=UTF-8");
        xmlHttp.send(JSON.stringify(json));
    }
}